package cn.com.contec.db;

import cn.com.contec.bean.EcgFile;
import cn.com.contec.util.ICommTConstant;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class DBOpenHelper extends SQLiteOpenHelper {
	private static final String DBNAME = "MINIECG.db";

	private static final int VERSION = 3;

	public DBOpenHelper(Context context) {

		super(context, DBNAME, null, VERSION);

	}

	

	/**
	 *Ecg file
	 */
	private static final String ECG_FILE_TABLE_CREATE = "CREATE TABLE "
		+ ICommTConstant.CONTACTS_ECG_FILE_TABLE + " (" + EcgFile._ID
		+ " integer primary key autoincrement," 
		+ EcgFile.FILE_ADD   + " text,"
		+ EcgFile.FILE_TIME  + " text,"
		+ EcgFile.PLUSE         + " text, "
		+ EcgFile.FILE_LENGTH         + " text );";

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(ECG_FILE_TABLE_CREATE);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS " + ICommTConstant.CONTACTS_ECG_FILE_TABLE);
		onCreate(db);
	}
}
